/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package controlacciones.ejb3.entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author vanessa
 */
@Entity
@Table(name = "tb_area")
@NamedQueries({
    @NamedQuery(name = "TbArea.findAll", query = "SELECT t FROM TbArea t"),
    @NamedQuery(name = "TbArea.findByCodArea", query = "SELECT t FROM TbArea t WHERE t.codArea = :codArea"),
    @NamedQuery(name = "TbArea.findByDescripcion", query = "SELECT t FROM TbArea t WHERE t.descripcion = :descripcion")})
public class TbArea implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "cod_area")
    private String codArea;
    @Column(name = "descripcion")
    private String descripcion;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tbArea")
    private Collection<TbTipoAccionClasificacionAccionArea> tbTipoAccionClasificacionAccionAreaCollection;

    public TbArea() {
    }

    public TbArea(String codArea) {
        this.codArea = codArea;
    }

    public String getCodArea() {
        return codArea;
    }

    public void setCodArea(String codArea) {
        this.codArea = codArea;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    public Collection<TbTipoAccionClasificacionAccionArea> getTbTipoAccionClasificacionAccionAreaCollection() {
        return tbTipoAccionClasificacionAccionAreaCollection;
    }

    public void setTbTipoAccionClasificacionAccionAreaCollection(Collection<TbTipoAccionClasificacionAccionArea> tbTipoAccionClasificacionAccionAreaCollection) {
        this.tbTipoAccionClasificacionAccionAreaCollection = tbTipoAccionClasificacionAccionAreaCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codArea != null ? codArea.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TbArea)) {
            return false;
        }
        TbArea other = (TbArea) object;
        if ((this.codArea == null && other.codArea != null) || (this.codArea != null && !this.codArea.equals(other.codArea))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString(){
        String toString = null;
        toString = this.getCodArea() + "-" + this.getDescripcion();
        return toString;
    }

}
